layui.use(['form', 'table', 'laydate'], function () {
    var form = layui.form,
        layer = layui.layer,
        table = layui.table,
        $ = layui.$,
        laydate = layui.laydate;

    /**
     * 初始化表单，要加上，不然刷新部分组件可能会不加载
     */
    form.render();

    // 当前弹出层，防止ID被覆盖
    var parentIndex = layer.index;

    //初始化
    $(function(){
        var id = $("#id").val();
        if(id != '' && id != null && id != undefined){
            var index = layer.load(2);
            var url = "/web/boInfoSendMrg/getInfoById";
            $.get(url, {id: id}, function(data){
                layer.close(index);
                if(data.state == "200"){
                    $("#msgTemName").val(data.msgTemName);
                    $("#msgTemId").val(data.msgTemId);
                    $("#markTitle").val(data.markTitle);
                    $("#markId").val(data.markId);
                    $("#msgType").val(data.msgTypeName);
                    $("#sendStatus").val(data.sendStatusName);
                    $("#receiveName").val(data.receiveName);
                    $("#receivePhone").val(data.receivePhone);
                    $("#bizId").val(data.bizId);
                    $("#sendResult").val(data.sendResultName);
                    $("#againSend").val(data.againSendName);
                    $("#sendDate").val(data.sendDate);
                    $("#errorContent").val(data.errorContent);
                    $("#remark").val(data.remark);
                    $("#content").val(data.content);
                }
                form.render();
            })
        }
    });


    $("#closeBtn").on("click", function(){
        // 关闭弹出层
        layer.close(parentIndex);
    });

});